#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
typedef char DataType;
typedef struct StackLink{
	DataType data;
	struct StackLink* next;
}Stack;
//void StackInit(Stack* s)
//{
//	s = (ListNode*)malloc(sizeof(ListNode));
//	s->next = NULL;
//}
//void StackInit(ListNode* s)
//{
//	s = (ListNode*)malloc(sizeof(ListNode));
//	s->next = NULL;
//}
void StackInit(Stack* s)
{
	s = (Stack*)malloc(sizeof(Stack));
	s->next = NULL;
}
void DestroyStack(Stack* s)
{
	Stack* cur = s->next;
	while (cur)
	{
		Stack* next = cur->next;
		free(cur);
		cur = next;
	}
	free(s);
}
void DestroyStack(Stack* s)
{
	Stack* cur = s->next;
	while (cur)
	{
		Stack* next = cur->next;
		free(s);
		cur = next;
	}
	free(s);
}
bool StackEmpty(Stack* s)
{
	return s->next == NULL;
}
void StackPush(Stack* &s, DataType x)
{
	Stack* newnode = (Stack*)malloc(sizeof(Stack));
	newnode->data = x;
	newnode->next = s->next;
	s->next = newnode;
}
void StackPush(Stack*& s, DataType x)
{
	Stack* p = (Stack*)malloc(sizeof(Stack));
	p->data = x;
	p->next = s->next;
	s->next = p;
}
bool StackPop(Stack*& s, DataType& e)
{
	Stack* p = (Stack*)malloc(sizeof(Stack));
	if (s->next == NULL)
		return false;
	p = s->next;
	e = p->data;
	s->next = p->next;
	free(p);
	return true;
}
bool StackPop(Stack*& s, DataType& e)
{
	Stack* p = (Stack*)malloc(sizeof(Stack));
	if (s->next == NULL)
		return false;
	p = s->next;
	e = p->data;
	s->next = p->next;
	free(p);
	return true;
}
bool GetTop(Stack* s, DataType& e)
{
	if (s->next == NULL)
		return false;
	e = s->next->data;
	return true;
}
bool GetTop(Stack* s, DataType& e)
{
	if (s->next == NULL)
		return false;
	e = s->next->data;
	return true;
}